package top.lingchen.blogapi.vo;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @Author 凌宸
 * @create 2021-12-15 下午 9:01
 * @Description
 * @Version 1.0
 */
@Data
@AllArgsConstructor
public class Result {
    // 方法返回是否是成功
    private boolean success;
    // 返回代码
    private int code;
    // 返回信息
    private String msg;
    // 返回数据
    private Object data;

    public static Result success(Object data){
        return new Result(true, 200, "success", data);
    }

    public static Result fail(int code, String msg){
        return new Result(false, code, msg, null);
    }
}
